package com.woniu.product.controller;

import com.woniu.common.utils.PageParam;
import com.woniu.common.utils.ResponseData;
import com.woniu.product.dto.CouponAddDTO;
import com.woniu.product.dto.CouponQueryDTO;
import com.woniu.product.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.*;

/**
 * packageName com.woniu.product.controller
 *
 * @author zxyang3636
 * @version JDK 8
 * @className CuoponController
 * @date 2024/8/10
 * @description TODO
 */
@RestController
public class CuoponController {

    @Autowired
    private CouponService couponService;

    @PostMapping("/selCouponByCondition")
    public ResponseData<?> selCouponByCondition(@RequestBody PageParam<CouponQueryDTO> pageParam) {
        return couponService.selCouponByCondition(pageParam);
    }

    @PostMapping("/addCoupon")
    public ResponseData<?> addCoupon(@RequestBody CouponAddDTO couponAddDTO) {
        return couponService.addCoupon(couponAddDTO);
    }

    @GetMapping("/stopCoupon")
    public ResponseData<?> stopCoupon(@RequestParam("couponId") String couponId) {
        return couponService.stopCoupon(couponId);
    }

}
